#ifndef GAME_H
#define GAME_H
#include <string>
#include <QWidget>
#include "Hand.h"
#include "Card.h"
#include "bid.h"
#include "Client.h"
#include "Card.h"
#include "Player.h"
#include<QtCore>


namespace Ui {
class game;
}

class game : public QWidget
{
    Q_OBJECT

public:
    explicit game(QWidget *parent = 0);
    ~game();
    void set_score(QString wea, QString web, QString thea, QString theb);
    void showPlayerList(QStringList d);
    /*!
     * \brief changeNorthHand This function displays the hand of the North player on the gui, whether it is a dummy or a local player
     */
    void changeNorthHand(Hand * );
    /*!
     * \brief changeEastHand This function displays the hand of the East player on the gui, whether it is a dummy or a local player
     */
    void changeEastHand(Hand *);
    /*!
     * \brief changeSouthHand This function displays the hand of the South player on the gui, whether it is a dummy or a local player
     */
    void changeSouthHand(Hand * );
    /*!
     * \brief changeWestHand This function displays the hand of the West player on the gui, whether it is a dummy or a local player
     */
    void changeWestHand(Hand *);
    /*!
     * \brief changeNorthPicture This function displays the card played by the North player on the trick table
     */
    void changeNorthPicture(Card *);
    /*!
     * \brief changeWestPicture This function displays the card played by the West player on the trick table
     */
    void changeWestPicture(Card *);
    /*!
     * \brief changeEastPicture This function displays the card played by the West player on the trick table
     */
    void changeEastPicture(Card *);
    /*!
     * \brief changeEastPicture This function displays the card played by the West player on the trick table
     */
    void changeSouthPicture(Card *);
    /*!
     * \brief displaymove This function updates the gui after validation of a move and calls changeXPicture to update the trick table
     */
    void displaymove(Card, int) ;
    /*!
     * \brief displaybid This function updates the gui by displaying the final bid contract
     * \param s This string contains the final bid contract.
     */
    void displaybid(std::string s);
    /*!
     * \brief setDummy This funtion alerts the gui of the dummy player
     */
    void setDummy(int);
    /*!
     * \brief Enable Enables all the cards and allows the user to make a move, for either dummy or local user
     */
    void Enable(bool);
    /*!
     * \brief Disable Disables all the cards and prevents the user from making a move, for either dummy or local user
     */
    void Disable();
    /*!
     * \brief connect_dummy Allows the dummy cards to be selected
     */
    void connect_dummy(int);
    /*!
     * \brief show_Dummy Displays the hand of the dummy user
     */
    void show_Dummy(Hand *);//**
    std::string getbid();
    bool s;
    bid *b;
    std::string bm;

    Client* CM;
    void displayIP(QString);
    /*!
     * \brief startDealing Alerts the gui that dealing of cards has started
     */
    void startDealing();
    /*!
     * \brief startSendHand Alerts the gui that a hand must be displayed, whether for the dummy or local user
     */
    void startSendHand();
    /*!
     * \brief startBidding Alerts the gui that bidding has started
     */
    void startBidding();
    /*!
     * \brief sendBid Informs the gui that the previous bid made by PlayerX was valid
     */
    void sendBid(QString);
    void sendContract(QString);
    /*!
     * \brief startPlaying Alerts the gui that bidding is complete and the first move can be made
     */
    void startPlaying();
    /*!
     * \brief getMove Enables the cards of either the local player or the dummy player to be selected
     */
    void getMove(bool);
    void endTrick();
    void newGame();
    void trickWinner(QString);
    void gameWinner(QString);


private slots:
    /*!
     * \brief South_1_Pressed onClick event for a players cards
     */
    void South_1_Pressed();
    void South_2_Pressed();
    void South_3_Pressed();
    void South_4_Pressed();
    void South_5_Pressed();
    void South_6_Pressed();
    void South_7_Pressed();
    void South_8_Pressed();
    void South_9_Pressed();
    void South_10_Pressed();
    void South_11_Pressed();
    void South_12_Pressed();
    void South_13_Pressed();
    void North_1_Pressed();
    void North_2_Pressed();
    void North_3_Pressed();
    void North_4_Pressed();
    void North_5_Pressed();
    void North_6_Pressed();
    void North_7_Pressed();
    void North_8_Pressed();
    void North_9_Pressed();
    void North_10_Pressed();
    void North_11_Pressed();
    void North_12_Pressed();
    void North_13_Pressed();
    void West_1_Pressed();
    void West_2_Pressed();
    void West_3_Pressed();
    void West_4_Pressed();
    void West_5_Pressed();
    void West_6_Pressed();
    void West_7_Pressed();
    void West_8_Pressed();
    void West_9_Pressed();
    void West_10_Pressed();
    void West_11_Pressed();
    void West_12_Pressed();
    void West_13_Pressed();
    void East_1_Pressed();
    void East_2_Pressed();
    void East_3_Pressed();
    void East_4_Pressed();
    void East_5_Pressed();
    void East_6_Pressed();
    void East_7_Pressed();
    void East_8_Pressed();
    void East_9_Pressed();
    void East_10_Pressed();
    void East_11_Pressed();
    void East_12_Pressed();
    void East_13_Pressed();
    void on_btnQuit_clicked();

    void on_pushButton_clicked();

    void on_btnCloseScore_clicked();

    void on_btnScore_clicked();

public slots:
    /*!
     * \brief changebid sends the players bid to the gamemaster
     */
    void changebid(QStringList );
    /*!
     * \brief createclient Creates the client object if user is a client
     */
    void createclient(QStringList);
    /*!
     * \brief createGM Creates the gamemaster object if user is a host
     */
    void createGM();

private:
    Ui::game *ui;
    Hand *south;
    Hand dummy_hand;
    int dummy;
    int s_num;
    int d_num;
signals:
    void exit();

};

#endif // GAME_H
